secret_card_counter = {}
total = 0
with open('D:/IdeaProjects/Test/统计数据.txt', 'r', encoding='utf8') as f:
    for line in f:
        line_split = line.split('=')
        secret_card = line_split[0]
        counter = line_split[1]
        secret_card_counter[secret_card] = int(counter)
        total += 1
        print('open1 total is {}'.format(total))

total = 0
with open('D:/PycharmProjects/PyTorchTest/read_test/202205part2.csv_results/202205part2.csv-0-100001.CSV', 'r', encoding='utf8') as f:
    for line in f:
        if line == '"\n':
            continue

        line = line.replace('"', '').replace('\n', '').replace("'", "")
        line_split = line.split(',')

        if len(line_split) < 8:
            print(line)
        secret_card = line_split[7]
        if secret_card not in secret_card_counter:
            secret_card_counter[secret_card] = 0
        secret_card_counter[secret_card] += 1
        total += 1
        print('open2 total is {}'.format(total))

total = 0
with open('secret_counter', 'w', encoding='utf8') as f:
    for secret_card, count in secret_card_counter.items():
        line = '{}={}\n'.format(secret_card, count)
        f.write(line)
        total += 1
        print('open3 total is {}'.format(total))